Optimal. Leaf size=175 \[ \frac {a^3 b^2 x}{\left (a^2+b^2\right )^3}-\frac {a b^2 x}{2 \left (a^2+b^2\right )^2}+\frac {a x}{8 \left (a^2+b^2\right )}-\frac {b \cos ^4(x)}{4 \left (a^2+b^2\right )}+\frac {a^2 b^3 \log (a \cos (x)+b \sin (x))}{\left (a^2+b^2\right )^3}-\frac {a b^2 \cos (x) \sin (x)}{2 \left (a^2+b^2\right )^2}+\frac {a \cos (x) \sin (x)}{8 \left (a^2+b^2\right )}-\frac {a \cos ^3(x) \sin (x)}{4 \left (a^2+b^2\right )}-\frac {a^2 b \sin ^2(x)}{2 \left (a^2+b^2\right )^2} \]
[Out]
________________________________________________________________________________________
Rubi [A]
time = 0.19, antiderivative size = 175, normalized size of antiderivative = 1.00, number of steps
used = 13, number of rules used = 9, integrand size = 20, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.450, Rules used = {3188, 2645,
30, 2648, 2715, 8, 2644, 3177, 3212} \begin {gather*} \frac {a x}{8 \left (a^2+b^2\right )}-\frac {a b^2 x}{2 \left (a^2+b^2\right )^2}-\frac {a^2 b \sin ^2(x)}{2 \left (a^2+b^2\right )^2}-\frac {b \cos ^4(x)}{4 \left (a^2+b^2\right )}-\frac {a \sin (x) \cos ^3(x)}{4 \left (a^2+b^2\right )}+\frac {a \sin (x) \cos (x)}{8 \left (a^2+b^2\right )}-\frac {a b^2 \sin (x) \cos (x)}{2 \left (a^2+b^2\right )^2}+\frac {a^2 b^3 \log (a \cos (x)+b \sin (x))}{\left (a^2+b^2\right )^3}+\frac {a^3 b^2 x}{\left (a^2+b^2\right )^3} \end {gather*}
Antiderivative was successfully verified.
[In]
[Out]
Rule 8
Rule 30
Rule 2644
Rule 2645
Rule 2648
Rule 2715
Rule 3177
Rule 3188
Rule 3212
Rubi steps
\begin {align*} \int \frac {\cos ^3(x) \sin ^2(x)}{a \cos (x)+b \sin (x)} \, dx &=\frac {a \int \cos ^2(x) \sin ^2(x) \, dx}{a^2+b^2}+\frac {b \int \cos ^3(x) \sin (x) \, dx}{a^2+b^2}-\frac {(a b) \int \frac {\cos ^2(x) \sin (x)}{a \cos (x)+b \sin (x)} \, dx}{a^2+b^2}\\ &=-\frac {a \cos ^3(x) \sin (x)}{4 \left (a^2+b^2\right )}-\frac {\left (a^2 b\right ) \int \cos (x) \sin (x) \, dx}{\left (a^2+b^2\right )^2}-\frac {\left (a b^2\right ) \int \cos ^2(x) \, dx}{\left (a^2+b^2\right )^2}+\frac {\left (a^2 b^2\right ) \int \frac {\cos (x)}{a \cos (x)+b \sin (x)} \, dx}{\left (a^2+b^2\right )^2}+\frac {a \int \cos ^2(x) \, dx}{4 \left (a^2+b^2\right )}-\frac {b \text {Subst}\left (\int x^3 \, dx,x,\cos (x)\right )}{a^2+b^2}\\ &=\frac {a^3 b^2 x}{\left (a^2+b^2\right )^3}-\frac {b \cos ^4(x)}{4 \left (a^2+b^2\right )}-\frac {a b^2 \cos (x) \sin (x)}{2 \left (a^2+b^2\right )^2}+\frac {a \cos (x) \sin (x)}{8 \left (a^2+b^2\right )}-\frac {a \cos ^3(x) \sin (x)}{4 \left (a^2+b^2\right )}+\frac {\left (a^2 b^3\right ) \int \frac {b \cos (x)-a \sin (x)}{a \cos (x)+b \sin (x)} \, dx}{\left (a^2+b^2\right )^3}-\frac {\left (a^2 b\right ) \text {Subst}(\int x \, dx,x,\sin (x))}{\left (a^2+b^2\right )^2}-\frac {\left (a b^2\right ) \int 1 \, dx}{2 \left (a^2+b^2\right )^2}+\frac {a \int 1 \, dx}{8 \left (a^2+b^2\right )}\\ &=\frac {a^3 b^2 x}{\left (a^2+b^2\right )^3}-\frac {a b^2 x}{2 \left (a^2+b^2\right )^2}+\frac {a x}{8 \left (a^2+b^2\right )}-\frac {b \cos ^4(x)}{4 \left (a^2+b^2\right )}+\frac {a^2 b^3 \log (a \cos (x)+b \sin (x))}{\left (a^2+b^2\right )^3}-\frac {a b^2 \cos (x) \sin (x)}{2 \left (a^2+b^2\right )^2}+\frac {a \cos (x) \sin (x)}{8 \left (a^2+b^2\right )}-\frac {a \cos ^3(x) \sin (x)}{4 \left (a^2+b^2\right )}-\frac {a^2 b \sin ^2(x)}{2 \left (a^2+b^2\right )^2}\\ \end {align*}
________________________________________________________________________________________
Mathematica [C] Result contains complex when optimal does not.
time = 0.81, size = 287, normalized size = 1.64 \begin {gather*} -\frac {-4 a^5 x+4 i a^4 b x-24 a^3 b^2 x-24 i a^2 b^3 x+12 a b^4 x+4 i b^5 x-4 i b \left (a^4-6 a^2 b^2+b^4\right ) \text {ArcTan}(\tan (x))+4 b \left (-a^4+b^4\right ) \cos (2 x)+a^4 b \cos (4 x)+2 a^2 b^3 \cos (4 x)+b^5 \cos (4 x)-4 a^4 b \log (a \cos (x)+b \sin (x))-8 a^2 b^3 \log (a \cos (x)+b \sin (x))-4 b^5 \log (a \cos (x)+b \sin (x))+2 a^4 b \log \left ((a \cos (x)+b \sin (x))^2\right )-12 a^2 b^3 \log \left ((a \cos (x)+b \sin (x))^2\right )+2 b^5 \log \left ((a \cos (x)+b \sin (x))^2\right )+8 a^3 b^2 \sin (2 x)+8 a b^4 \sin (2 x)+a^5 \sin (4 x)+2 a^3 b^2 \sin (4 x)+a b^4 \sin (4 x)}{32 \left (a^2+b^2\right )^3} \end {gather*}
Antiderivative was successfully verified.
[In]
[Out]
________________________________________________________________________________________
Maple [A]
time = 0.25, size = 163, normalized size = 0.93
method | result | size |
default | \(\frac {a^{2} b^{3} \ln \left (a +b \tan \left (x \right )\right )}{\left (a^{2}+b^{2}\right )^{3}}+\frac {\frac {\left (\frac {1}{8} a^{5}-\frac {1}{4} a^{3} b^{2}-\frac {3}{8} a \,b^{4}\right ) \left (\tan ^{3}\left (x \right )\right )+\left (\frac {1}{2} b \,a^{4}+\frac {1}{2} b^{3} a^{2}\right ) \left (\tan ^{2}\left (x \right )\right )+\left (-\frac {3}{4} a^{3} b^{2}-\frac {5}{8} a \,b^{4}-\frac {1}{8} a^{5}\right ) \tan \left (x \right )+\frac {b \,a^{4}}{4}-\frac {b^{5}}{4}}{\left (\tan ^{2}\left (x \right )+1\right )^{2}}+\frac {a \left (-4 a \,b^{3} \ln \left (\tan ^{2}\left (x \right )+1\right )+\left (a^{4}+6 a^{2} b^{2}-3 b^{4}\right ) \arctan \left (\tan \left (x \right )\right )\right )}{8}}{\left (a^{2}+b^{2}\right )^{3}}\) | \(163\) |
risch | \(\frac {3 i a x b}{4 \left (6 i a^{2} b -2 i b^{3}-2 a^{3}+6 a \,b^{2}\right )}-\frac {a^{2} x}{4 \left (6 i a^{2} b -2 i b^{3}-2 a^{3}+6 a \,b^{2}\right )}-\frac {b \,{\mathrm e}^{2 i x}}{16 \left (2 i a b -a^{2}+b^{2}\right )}-\frac {b \,{\mathrm e}^{-2 i x}}{16 \left (-i a +b \right )^{2}}-\frac {2 i b^{3} a^{2} x}{a^{6}+3 a^{4} b^{2}+3 a^{2} b^{4}+b^{6}}+\frac {b^{3} a^{2} \ln \left ({\mathrm e}^{2 i x}-\frac {i b +a}{i b -a}\right )}{a^{6}+3 a^{4} b^{2}+3 a^{2} b^{4}+b^{6}}+\frac {b \cos \left (4 x \right )}{-32 a^{2}-32 b^{2}}+\frac {a \sin \left (4 x \right )}{-32 a^{2}-32 b^{2}}\) | \(240\) |
norman | \(\frac {\frac {2 b^{3} \left (\tan ^{2}\left (\frac {x}{2}\right )\right )}{a^{4}+2 a^{2} b^{2}+b^{4}}+\frac {2 b^{3} \left (\tan ^{8}\left (\frac {x}{2}\right )\right )}{a^{4}+2 a^{2} b^{2}+b^{4}}+\frac {2 \left (-2 a^{2} b +b^{3}\right ) \left (\tan ^{4}\left (\frac {x}{2}\right )\right )}{a^{4}+2 a^{2} b^{2}+b^{4}}+\frac {2 \left (-2 a^{2} b +b^{3}\right ) \left (\tan ^{6}\left (\frac {x}{2}\right )\right )}{a^{4}+2 a^{2} b^{2}+b^{4}}+\frac {a \left (a^{4}+6 a^{2} b^{2}-3 b^{4}\right ) x}{8 a^{6}+24 a^{4} b^{2}+24 a^{2} b^{4}+8 b^{6}}-\frac {\left (a^{2}+5 b^{2}\right ) a \tan \left (\frac {x}{2}\right )}{4 \left (a^{4}+2 a^{2} b^{2}+b^{4}\right )}+\frac {\left (a^{2}+5 b^{2}\right ) a \left (\tan ^{9}\left (\frac {x}{2}\right )\right )}{4 a^{4}+8 a^{2} b^{2}+4 b^{4}}+\frac {\left (3 a^{2}-b^{2}\right ) a \left (\tan ^{3}\left (\frac {x}{2}\right )\right )}{2 a^{4}+4 a^{2} b^{2}+2 b^{4}}-\frac {\left (3 a^{2}-b^{2}\right ) a \left (\tan ^{7}\left (\frac {x}{2}\right )\right )}{2 \left (a^{4}+2 a^{2} b^{2}+b^{4}\right )}+\frac {5 a \left (a^{4}+6 a^{2} b^{2}-3 b^{4}\right ) x \left (\tan ^{2}\left (\frac {x}{2}\right )\right )}{8 \left (a^{6}+3 a^{4} b^{2}+3 a^{2} b^{4}+b^{6}\right )}+\frac {5 a \left (a^{4}+6 a^{2} b^{2}-3 b^{4}\right ) x \left (\tan ^{4}\left (\frac {x}{2}\right )\right )}{4 \left (a^{6}+3 a^{4} b^{2}+3 a^{2} b^{4}+b^{6}\right )}+\frac {5 a \left (a^{4}+6 a^{2} b^{2}-3 b^{4}\right ) x \left (\tan ^{6}\left (\frac {x}{2}\right )\right )}{4 \left (a^{6}+3 a^{4} b^{2}+3 a^{2} b^{4}+b^{6}\right )}+\frac {5 a \left (a^{4}+6 a^{2} b^{2}-3 b^{4}\right ) x \left (\tan ^{8}\left (\frac {x}{2}\right )\right )}{8 \left (a^{6}+3 a^{4} b^{2}+3 a^{2} b^{4}+b^{6}\right )}+\frac {a \left (a^{4}+6 a^{2} b^{2}-3 b^{4}\right ) x \left (\tan ^{10}\left (\frac {x}{2}\right )\right )}{8 a^{6}+24 a^{4} b^{2}+24 a^{2} b^{4}+8 b^{6}}}{\left (1+\tan ^{2}\left (\frac {x}{2}\right )\right )^{5}}+\frac {b^{3} a^{2} \ln \left (a \left (\tan ^{2}\left (\frac {x}{2}\right )\right )-2 b \tan \left (\frac {x}{2}\right )-a \right )}{a^{6}+3 a^{4} b^{2}+3 a^{2} b^{4}+b^{6}}-\frac {b^{3} a^{2} \ln \left (1+\tan ^{2}\left (\frac {x}{2}\right )\right )}{a^{6}+3 a^{4} b^{2}+3 a^{2} b^{4}+b^{6}}\) | \(682\) |
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Maxima [B] Leaf count of result is larger than twice the leaf count of optimal. 424 vs.
\(2 (161) = 322\).
time = 0.52, size = 424, normalized size = 2.42 \begin {gather*} \frac {a^{2} b^{3} \log \left (-a - \frac {2 \, b \sin \left (x\right )}{\cos \left (x\right ) + 1} + \frac {a \sin \left (x\right )^{2}}{{\left (\cos \left (x\right ) + 1\right )}^{2}}\right )}{a^{6} + 3 \, a^{4} b^{2} + 3 \, a^{2} b^{4} + b^{6}} - \frac {a^{2} b^{3} \log \left (\frac {\sin \left (x\right )^{2}}{{\left (\cos \left (x\right ) + 1\right )}^{2}} + 1\right )}{a^{6} + 3 \, a^{4} b^{2} + 3 \, a^{2} b^{4} + b^{6}} + \frac {{\left (a^{5} + 6 \, a^{3} b^{2} - 3 \, a b^{4}\right )} \arctan \left (\frac {\sin \left (x\right )}{\cos \left (x\right ) + 1}\right )}{4 \, {\left (a^{6} + 3 \, a^{4} b^{2} + 3 \, a^{2} b^{4} + b^{6}\right )}} + \frac {\frac {8 \, b^{3} \sin \left (x\right )^{2}}{{\left (\cos \left (x\right ) + 1\right )}^{2}} - \frac {16 \, a^{2} b \sin \left (x\right )^{4}}{{\left (\cos \left (x\right ) + 1\right )}^{4}} + \frac {8 \, b^{3} \sin \left (x\right )^{6}}{{\left (\cos \left (x\right ) + 1\right )}^{6}} - \frac {{\left (a^{3} + 5 \, a b^{2}\right )} \sin \left (x\right )}{\cos \left (x\right ) + 1} + \frac {{\left (7 \, a^{3} + 3 \, a b^{2}\right )} \sin \left (x\right )^{3}}{{\left (\cos \left (x\right ) + 1\right )}^{3}} - \frac {{\left (7 \, a^{3} + 3 \, a b^{2}\right )} \sin \left (x\right )^{5}}{{\left (\cos \left (x\right ) + 1\right )}^{5}} + \frac {{\left (a^{3} + 5 \, a b^{2}\right )} \sin \left (x\right )^{7}}{{\left (\cos \left (x\right ) + 1\right )}^{7}}}{4 \, {\left (a^{4} + 2 \, a^{2} b^{2} + b^{4} + \frac {4 \, {\left (a^{4} + 2 \, a^{2} b^{2} + b^{4}\right )} \sin \left (x\right )^{2}}{{\left (\cos \left (x\right ) + 1\right )}^{2}} + \frac {6 \, {\left (a^{4} + 2 \, a^{2} b^{2} + b^{4}\right )} \sin \left (x\right )^{4}}{{\left (\cos \left (x\right ) + 1\right )}^{4}} + \frac {4 \, {\left (a^{4} + 2 \, a^{2} b^{2} + b^{4}\right )} \sin \left (x\right )^{6}}{{\left (\cos \left (x\right ) + 1\right )}^{6}} + \frac {{\left (a^{4} + 2 \, a^{2} b^{2} + b^{4}\right )} \sin \left (x\right )^{8}}{{\left (\cos \left (x\right ) + 1\right )}^{8}}\right )}} \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Fricas [A]
time = 1.99, size = 175, normalized size = 1.00 \begin {gather*} \frac {4 \, a^{2} b^{3} \log \left (2 \, a b \cos \left (x\right ) \sin \left (x\right ) + {\left (a^{2} - b^{2}\right )} \cos \left (x\right )^{2} + b^{2}\right ) - 2 \, {\left (a^{4} b + 2 \, a^{2} b^{3} + b^{5}\right )} \cos \left (x\right )^{4} + 4 \, {\left (a^{4} b + a^{2} b^{3}\right )} \cos \left (x\right )^{2} + {\left (a^{5} + 6 \, a^{3} b^{2} - 3 \, a b^{4}\right )} x - {\left (2 \, {\left (a^{5} + 2 \, a^{3} b^{2} + a b^{4}\right )} \cos \left (x\right )^{3} - {\left (a^{5} - 2 \, a^{3} b^{2} - 3 \, a b^{4}\right )} \cos \left (x\right )\right )} \sin \left (x\right )}{8 \, {\left (a^{6} + 3 \, a^{4} b^{2} + 3 \, a^{2} b^{4} + b^{6}\right )}} \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Sympy [F(-1)] Timed out
time = 0.00, size = 0, normalized size = 0.00 \begin {gather*} \text {Timed out} \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Giac [A]
time = 0.46, size = 273, normalized size = 1.56 \begin {gather*} \frac {a^{2} b^{4} \log \left ({\left | b \tan \left (x\right ) + a \right |}\right )}{a^{6} b + 3 \, a^{4} b^{3} + 3 \, a^{2} b^{5} + b^{7}} - \frac {a^{2} b^{3} \log \left (\tan \left (x\right )^{2} + 1\right )}{2 \, {\left (a^{6} + 3 \, a^{4} b^{2} + 3 \, a^{2} b^{4} + b^{6}\right )}} + \frac {{\left (a^{5} + 6 \, a^{3} b^{2} - 3 \, a b^{4}\right )} x}{8 \, {\left (a^{6} + 3 \, a^{4} b^{2} + 3 \, a^{2} b^{4} + b^{6}\right )}} + \frac {6 \, a^{2} b^{3} \tan \left (x\right )^{4} + a^{5} \tan \left (x\right )^{3} - 2 \, a^{3} b^{2} \tan \left (x\right )^{3} - 3 \, a b^{4} \tan \left (x\right )^{3} + 4 \, a^{4} b \tan \left (x\right )^{2} + 16 \, a^{2} b^{3} \tan \left (x\right )^{2} - a^{5} \tan \left (x\right ) - 6 \, a^{3} b^{2} \tan \left (x\right ) - 5 \, a b^{4} \tan \left (x\right ) + 2 \, a^{4} b + 6 \, a^{2} b^{3} - 2 \, b^{5}}{8 \, {\left (a^{6} + 3 \, a^{4} b^{2} + 3 \, a^{2} b^{4} + b^{6}\right )} {\left (\tan \left (x\right )^{2} + 1\right )}^{2}} \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Mupad [B]
time = 11.14, size = 2500, normalized size = 14.29 \begin {gather*} \text {Too large to display} \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________